﻿#pragma once
#ifndef XL_XEXPAND_DWEBX_WORESPONSE_H
//@隐藏{
#define XL_XEXPAND_DWEBX_WORESPONSE_H
//@隐藏}

//@别名 Wo传出回复类
class WEBOAT_MODIFICATION WoHTTPOutgoingResponseClass {
private:
	bool infom = false;
	WoHTTPOutgoingResponsePtr m_OutgoingResponse;
public:
	//@隐藏{
	WoHTTPOutgoingResponseClass() { m_OutgoingResponse = WoCreateResponseFast(200, ""); };
	WoHTTPOutgoingResponseClass(const char* str) { m_OutgoingResponse = WoCreateResponseFast(200, str); };
	~WoHTTPOutgoingResponseClass() {};
	WoHTTPOutgoingResponseClass(WoHTTPOutgoingResponsePtr& ptr) { m_OutgoingResponse = ptr; };
	void operator=(WoHTTPOutgoingResponsePtr& ptr) { m_OutgoingResponse = ptr; infom = true; };

	void operator=(const char* str) { WoResponseBodySetTextA(m_OutgoingResponse, str); };
	//operator WoHTTPOutgoingResponsePtr() {return m_OutgoingResponse;};
	operator WoHTTPOutgoingResponsePtr& () { return m_OutgoingResponse; };
	//@隐藏}

	//@备注 向返回体写入字节集
	//@别名 写入字节集(字节集数据,长度)
	void AddByte(const char* data, UINT size) {
		WoResponseBodyAddBuffer(m_OutgoingResponse, data, size);
	};
	//@备注 向返回体写入字节集
	//@别名 置字节集(字节集数据,长度)
	void SetByte(const char* data, UINT size) {
		WoResponseBodySetBuffer(m_OutgoingResponse, data, size);
	};
	//@备注 向返回体写入文本
	//@别名 写入文本(文本数据)
	void AddTextA(const char* str) {
		WoResponseBodyAddTextA(m_OutgoingResponse, str);
	};
	//@备注 向返回体写入文本
	//@别名 置单文本(文本数据)
	void SetByte(const char* str) {
		WoResponseBodySetTextA(m_OutgoingResponse, str);
	};
	//@别名 取数据大小()
	UINT size() {
		return WoResponseBodySize(m_OutgoingResponse);
	}

	//@别名 添加头(键名,值)
	void PutHander(const char* key, const char* value) {
		WoResponsePutHeader(m_OutgoingResponse, key, value);
	};
	//@别名 获取头(键名)
	void GetHander(const char* key) {
		WoResponseGetHeader(m_OutgoingResponse, key);
	};
	//@别名 获取所有头(返回数据)
	void GetHanders(CXMap<CXTextA, CXTextA>& rmap) {
		WoResponseGetHeaders(m_OutgoingResponse, rmap);
	};

};

#endif